
#include "copyright.h"
#include "synch.h"
#include "system.h"
#include <iostream>

Thread *techThreads;


Lock *techLock;
Condition *techMovieVariable;
Condition *techManagerVariable;

/*int techLock;
int techMovieVariable;
int techManagerVariable;*/
void Tech()
{


	while (true)
	{
		if(movieStarted==0)
			
			techManagerVariable->Wait(techLock); /* Wait for the signal to start the movie.*/
			
			/*CVWait(techManagerVariable, techLock);*/
		while(custsSeated!=ticketsTaken)
		{
			for(int i = 0;i<500;i++)
				currentThread->Yield();
		}
		printf("Ticket tech starting movie\n");
		for (int i = 0; i < 3; i++) /*starts the movie for 300 counts while using current thread yield */
		{
			currentThread->Yield();
		}
		printf("Ticket tech ending movie\n");
		movieStarted=false;
		
		techMovieVariable->Broadcast(seatsFreeLock); /*broadcasts that the movie is over and the customers can move out */
		
		/*CVBroadcast(techMovieVariable, seatsFreeLock);*/
		seatedPeople=0;
	}
}

